<script setup lang="ts">
import type { ISearchRecomment } from '../../../../types/home'
import OpSearch from '@/components/OpSearch.vue'
interface IProps {
  recommends: ISearchRecomment[]
}
defineProps<IProps>()

interface IEmits {
  (e: 'searchClick'): void
}
const emits = defineEmits<IEmits>()
</script>

<template>
  <div class="home-top">
    <div class="top">
      <img class="top__location-icon" src="@/assets/imgs/index_page/location.png" />
      <div class="top__location">幸福小区(北一区东南门)</div>
      <img class="top__shopcart-icon" src="@/assets/imgs/index_page/shopcart.png" />
      <img class="top__comments-icon" src="@/assets/imgs/index_page/comments.png" />
    </div>
    <OpSearch
      shape="round"
      background="linear-gradient(to right, rgb(53, 200, 250), rgb(31, 175, 243))"
      placeholder="世界茶饮 35减2"
      @inputClick="emits('searchClick')"
    >
      <!-- <template #right-icon><div @click="emits('searchClick')">搜索</div></template> -->
    </OpSearch>
    <div class="search-recommend">
      <div v-for="item in recommends" :key="item.value" class="search-recommend__tag">
        {{ item.label }}
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.home-top {
  background: linear-gradient(to right, rgb(53, 200, 250), rgb(31, 175, 243));
  color: white;
}
.top {
  display: flex;
  align-items: center;
  padding: 10px 10px 0 10px;
  line-height: 15px;
  font-size: 15px;
  font-weight: bold;
  &__location-icon {
    width: 20px;
    height: 20px;
  }
  &__location {
    flex: 1;
  }
  &__shopcart-icon {
    width: 24px;
    height: 24px;
  }
  &__comments-icon {
    width: 28px;
    height: 24px;
    margin-left: 10px;
  }
}
.search-recommend {
  display: flex;
  padding: 0 10px 8px;
  &__tag {
    font-size: 12px;
    border-radius: 10px;
    background: rgb(242, 242, 242, 0.3);
    padding: 2px 8px;
    margin-right: 10px;
  }
}
</style>
../../../../repo/home
